home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Bank smakow / BankSmakow.air / BankSmakow.swf / scripts / com / makingwaves / view / PrintView.as < prev    next >
Text File  |  2009-12-16  |  9KB  |  247 lines

  1. package com.makingwaves.view
  2. {
  3.    import com.makingwaves.vo.Recipe;
  4.    import mx.containers.HBox;
  5.    import mx.containers.VBox;
  6.    import mx.controls.Image;
  7.    import mx.controls.Label;
  8.    import mx.controls.Spacer;
  9.    import mx.controls.Text;
  10.    import mx.core.UIComponentDescriptor;
  11.    import mx.core.mx_internal;
  12.    import mx.events.PropertyChangeEvent;
  13.    import mx.printing.FlexPrintJob;
  14.    import mx.styles.CSSStyleDeclaration;
  15.    
  16.    public class PrintView extends VBox
  17.    {
  18.        
  19.       
  20.       private var _351679175recipeName:Text;
  21.       
  22.       private var _2103719742ingredients:Text;
  23.       
  24.       private var _1315428713preparation:Text;
  25.       
  26.       private var _recipe:Recipe;
  27.       
  28.       private var _embed_mxml____assets_details_origin1_png_1061770266:Class;
  29.       
  30.       private var _documentDescriptor_:UIComponentDescriptor;
  31.       
  32.       public function PrintView()
  33.       {
  34.          _documentDescriptor_ = new UIComponentDescriptor({
  35.             "type":VBox,
  36.             "propertiesFactory":function():Object
  37.             {
  38.                return {"childDescriptors":[new UIComponentDescriptor({
  39.                   "type":VBox,
  40.                   "stylesFactory":function():void
  41.                   {
  42.                      this.verticalGap = 0;
  43.                      this.paddingTop = 40;
  44.                      this.paddingBottom = 40;
  45.                      this.paddingLeft = 40;
  46.                      this.paddingRight = 40;
  47.                   },
  48.                   "propertiesFactory":function():Object
  49.                   {
  50.                      return {
  51.                         "percentHeight":100,
  52.                         "width":800,
  53.                         "childDescriptors":[new UIComponentDescriptor({
  54.                            "type":Text,
  55.                            "id":"recipeName",
  56.                            "propertiesFactory":function():Object
  57.                            {
  58.                               return {
  59.                                  "styleName":"RecipeDetailsTitlePrint",
  60.                                  "width":720,
  61.                                  "x":50,
  62.                                  "y":90,
  63.                                  "percentHeight":100
  64.                               };
  65.                            }
  66.                         }),new UIComponentDescriptor({
  67.                            "type":HBox,
  68.                            "propertiesFactory":function():Object
  69.                            {
  70.                               return {
  71.                                  "percentHeight":100,
  72.                                  "width":720,
  73.                                  "childDescriptors":[new UIComponentDescriptor({
  74.                                     "type":Text,
  75.                                     "id":"ingredients",
  76.                                     "propertiesFactory":function():Object
  77.                                     {
  78.                                        return {
  79.                                           "styleName":"RecipeDetailsIngredientsPrint",
  80.                                           "width":550,
  81.                                           "percentHeight":100,
  82.                                           "selectable":false
  83.                                        };
  84.                                     }
  85.                                  }),new UIComponentDescriptor({
  86.                                     "type":Spacer,
  87.                                     "propertiesFactory":function():Object
  88.                                     {
  89.                                        return {"percentWidth":100};
  90.                                     }
  91.                                  }),new UIComponentDescriptor({
  92.                                     "type":Image,
  93.                                     "stylesFactory":function():void
  94.                                     {
  95.                                        this.right = "5";
  96.                                     },
  97.                                     "propertiesFactory":function():Object
  98.                                     {
  99.                                        return {
  100.                                           "source":_embed_mxml____assets_details_origin1_png_1061770266,
  101.                                           "width":120,
  102.                                           "height":120
  103.                                        };
  104.                                     }
  105.                                  })]
  106.                               };
  107.                            }
  108.                         }),new UIComponentDescriptor({
  109.                            "type":Spacer,
  110.                            "propertiesFactory":function():Object
  111.                            {
  112.                               return {"height":20};
  113.                            }
  114.                         }),new UIComponentDescriptor({
  115.                            "type":Label,
  116.                            "propertiesFactory":function():Object
  117.                            {
  118.                               return {
  119.                                  "text":"Spos├│b przygotowania",
  120.                                  "styleName":"RecipeDetailsPreparationTitlePrint"
  121.                               };
  122.                            }
  123.                         }),new UIComponentDescriptor({
  124.                            "type":Text,
  125.                            "id":"preparation",
  126.                            "propertiesFactory":function():Object
  127.                            {
  128.                               return {
  129.                                  "styleName":"RecipeDetailsPreparationPrint",
  130.                                  "width":720,
  131.                                  "percentHeight":100
  132.                               };
  133.                            }
  134.                         })]
  135.                      };
  136.                   }
  137.                })]};
  138.             }
  139.          });
  140.          _embed_mxml____assets_details_origin1_png_1061770266 = PrintView__embed_mxml____assets_details_origin1_png_1061770266;
  141.          super();
  142.          mx_internal::_document = this;
  143.          if(!this.styleDeclaration)
  144.          {
  145.             this.styleDeclaration = new CSSStyleDeclaration();
  146.          }
  147.          this.styleDeclaration.defaultFactory = function():void
  148.          {
  149.             this.backgroundColor = 16777215;
  150.             this.borderColor = 16777215;
  151.             this.borderThickness = 2;
  152.          };
  153.          this.horizontalScrollPolicy = "off";
  154.          this.verticalScrollPolicy = "off";
  155.       }
  156.       
  157.       [Bindable(event="propertyChange")]
  158.       public function get ingredients() : Text
  159.       {
  160.          return this._2103719742ingredients;
  161.       }
  162.       
  163.       public function set ingredients(param1:Text) : void
  164.       {
  165.          var _loc2_:Object = this._2103719742ingredients;
  166.          if(_loc2_ !== param1)
  167.          {
  168.             this._2103719742ingredients = param1;
  169.             this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"ingredients",_loc2_,param1));
  170.          }
  171.       }
  172.       
  173.       public function get recipe() : Recipe
  174.       {
  175.          return _recipe;
  176.       }
  177.       
  178.       private function set _934914674recipe(param1:Recipe) : void
  179.       {
  180.          _recipe = param1;
  181.       }
  182.       
  183.       override public function initialize() : void
  184.       {
  185.          mx_internal::setDocumentDescriptor(_documentDescriptor_);
  186.          super.initialize();
  187.       }
  188.       
  189.       [Bindable(event="propertyChange")]
  190.       public function set recipe(param1:Recipe) : void
  191.       {
  192.          var _loc2_:Object = this.recipe;
  193.          if(_loc2_ !== param1)
  194.          {
  195.             this._934914674recipe = param1;
  196.             this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"recipe",_loc2_,param1));
  197.          }
  198.       }
  199.       
  200.       [Bindable(event="propertyChange")]
  201.       public function get preparation() : Text
  202.       {
  203.          return this._1315428713preparation;
  204.       }
  205.       
  206.       public function doPrint() : void
  207.       {
  208.          ingredients.text = _recipe.ingredientsText;
  209.          recipeName.text = _recipe.name;
  210.          preparation.text = _recipe.preparation;
  211.          var _loc1_:FlexPrintJob = new FlexPrintJob();
  212.          if(_loc1_.start() != true)
  213.          {
  214.             return;
  215.          }
  216.          _loc1_.addObject(this);
  217.          _loc1_.send();
  218.       }
  219.       
  220.       public function set preparation(param1:Text) : void
  221.       {
  222.          var _loc2_:Object = this._1315428713preparation;
  223.          if(_loc2_ !== param1)
  224.          {
  225.             this._1315428713preparation = param1;
  226.             this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"preparation",_loc2_,param1));
  227.          }
  228.       }
  229.       
  230.       public function set recipeName(param1:Text) : void
  231.       {
  232.          var _loc2_:Object = this._351679175recipeName;
  233.          if(_loc2_ !== param1)
  234.          {
  235.             this._351679175recipeName = param1;
  236.             this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"recipeName",_loc2_,param1));
  237.          }
  238.       }
  239.       
  240.       [Bindable(event="propertyChange")]
  241.       public function get recipeName() : Text
  242.       {
  243.          return this._351679175recipeName;
  244.       }
  245.    }
  246. }
  247.